<?php
header("Content-type:text/html; charset=gbk;");

$config = include('config.php');

$redis = include('conn.php');

$action = isset($_GET["action"]) ? $_GET["action"] : "";

if($action == "sadd"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
	$result = $redis->sadd($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "sRemove"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
	$result = $redis->sremove($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "sIsMember"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
	$result = $redis->sIsMember($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "sPop"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$result = $redis->sPop($p1);
	var_dump($result);exit;
	
}else if($action == "sRandMember"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$result = $redis->sRandMember($p1);
	var_dump($result);exit;
	
}else if($action == "sInter"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
	$result = $redis->sInter($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "sInterStore"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
	$p3 = isset($_GET['p3']) ? addslashes($_GET['p3']) : "";
	$result = $redis->sInterStore($p1, $p2, $p3);
	var_dump($result);exit;
	
}else if($action == "sUnion"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
	$result = $redis->sUnion($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "sUnionStore"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
	$p3 = isset($_GET['p3']) ? addslashes($_GET['p3']) : "";
	$result = $redis->sUnionStore($p1, $p2, $p3);
	var_dump($result);exit;
	
}else if($action == "sDiff"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
	$result = $redis->sDiff($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "sDiffStore"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
	$p3 = isset($_GET['p3']) ? addslashes($_GET['p3']) : "";
	$result = $redis->sDiffStore($p1, $p2, $p3);
	var_dump($result);exit;
	
}else if($action == "sort"){
	
	$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
	$result = $redis->sort($p1);
	var_dump($result);
	$redis->sMembers($p1);
	exit;
	
}

?>
